<template>
	<view>
		<view class="content">
			<view class="row">
				<view class="nominal">
					<span>*</span>反馈主题
				</view>
				<view class="input">
					<input placeholder="请输入反馈主题" type="text" v-model="title" />
				</view>
			</view>
			<view class="row">
				<view class="nominal">
					<span>*</span>详细描述
				</view>
				<view class="input">
					<textarea placeholder="请输入详细描述" type="text" v-model="content" />
				</view>
			</view>

			<view class="row">
				<view class="nominal">
					联系手机
				</view>
				<view class="input">
					<input placeholder="请输入联系手机" type="text" v-model="mobile" />
				</view>
			</view>
			<view class="row">
				<view class="nominal">
					联系邮件
				</view>
				<view class="input">
					<input placeholder="请输入联系邮件" type="text" v-model="email" />
				</view>
			</view>
		</view>
		<view class="save" @tap="save">
			<view class="btn">
				确认提交
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				content: '',
				mobile: '',
				email: ''
			};
		},
		onShow() {
			uni.hideTabBar();
		},
		onLoad() {

		},
		methods: {
			save() {
				if (!this.title) {
					uni.showToast({
						title: '请输入反馈主题',
						icon: 'none'
					});
					return;
				}
				if (!this.content) {
					uni.showToast({
						title: '请输入详细描述',
						icon: 'none'
					});
					return;
				}
				uni.showLoading({
					title: '请稍后'
				})
				this.$api.http.post('common-feed-add', {
					title: this.title,
					content: this.content,
					mobile: this.mobile,
					email: this.email,

				}).then(res => {
					if (res) {
						if (res.code === 1) {
							this.$api.msg("提交成功")
							setTimeout(() => {
								uni.navigateBack();
							}, 1000)
						} else {
							this.$api.msg(res.msg)
						}
					}
				})
				uni.hideLoading();	
			}
		}
	};
</script>
<style lang="scss">
	page {
		background: #F3F3F3;
	}

	.save {
		z-index: 999;
		position: fixed;
		width: 100%;
		background: #fff;
		padding: 20rpx 0;
		bottom: 0;
		box-shadow: 0 0 10px #eee;

		view {
			display: flex;
		}

		.btn {
			width: 90%;
			height: 100rpx;
			border-radius: 100rpx;
			background: #3cbdc5;
			color: #fff;
			justify-content: center;
			align-items: center;
			font-size: 30rpx;
			margin: 0 auto;
		}
	}

	.content {
		display: flex;
		flex-wrap: wrap;
		margin-bottom: 185rpx;

		.yg {
			width: 100%;
		}

		.row {
			width: 94%;
			padding: 0 3%;

			.nominal {
				width: 100%;
				font-weight: bold;
				font-size: 28upx;
				align-items: center;
				margin-top: 50rpx;
				margin-bottom: 15rpx;

				span {
					color: #ff4c45;
					margin-right: 5rpx;
				}
			}

			.input {
				padding: 25rpx 20rpx;
				align-items: center;
				font-size: 26rpx;
				margin-top: 10rpx;
				background: #fff;
				border-radius: 10rpx;

				input {
					font-size: 26upx;
				}

				&.switch {
					justify-content: flex-end;
				}

				textarea {
					min-height: 90rpx;
					width: 100%;
				}

			}
		}
	}
</style>
